FUNCTION reallocint(p,n)
USE param
IMPLICIT NONE
INTEGER,POINTER,DIMENSION(:) :: reallocint,p
INTEGER,INTENT(in) :: n
INTEGER :: ierr,nold,i
ALLOCATE(reallocint(1:n),STAT=ierr)
IF(ierr.NE.0) STOP "ERR:reallocint function"
IF(.NOT.ASSOCIATED(p)) RETURN
nold=MIN(SIZE(p),n)
DO i=1,nold
   reallocint(i)=p(i)
END DO
DEALLOCATE(p)
END FUNCTION
